import os
import yaml

def load_cfg(cfg_path):
    assert os.path.exists(cfg_path), "config not exist !"
    with open(cfg_path,'r',encoding='utf-8') as F:
        cfg = yaml.load(F.read(),Loader=yaml.Loader)

    return cfg

def write_cfg(cfg_path,cfg):
    with open(cfg_path, 'w', encoding='utf-8') as F:
        yaml.dump(cfg, F)